package com.longcai.piaojia.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.longcai.piaojia.R;
import com.zcx.helper.bound.BoundView;
import com.zcx.helper.bound.BoundViewHelper;

/**
 * Created by Administrator on 2016/8/4.
 */
public class FragmentBusinessOrder extends BaseFragment implements View.OnClickListener {


    @BoundView(R.id.fragment_business_order_bepay_tv) private TextView fragment_business_order_bepay_tv;
    @BoundView(R.id.fragment_business_order_beused_tv) private TextView fragment_business_order_beused_tv;
    @BoundView(R.id.fragment_business_order_evaluated_tv) private TextView fragment_business_order_evaluated_tv;
    @BoundView(R.id.fragment_business_order_refunds_tv)  private TextView fragment_business_order_refunds_tv;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View view = BoundViewHelper.boundView(this, inflater.inflate(R.layout.fragment_business_order, null));

        fragment_business_order_bepay_tv.setOnClickListener(this);
        fragment_business_order_beused_tv.setOnClickListener(this);
        fragment_business_order_evaluated_tv.setOnClickListener(this);
        fragment_business_order_refunds_tv.setOnClickListener(this);

        fragment_business_order_bepay_tv.performClick();

        return view;
    }

    @Override
    public void onClick(View v) {

        switch (v.getId()) {
            case R.id.fragment_business_order_bepay_tv:
                initColor();
                fragment_business_order_bepay_tv.setTextColor(getActivity().getResources().getColor(R.color.pale_red_color));
                break;

            case R.id.fragment_business_order_beused_tv:
                initColor();
                fragment_business_order_beused_tv.setTextColor(getActivity().getResources().getColor(R.color.pale_red_color));
                break;

            case R.id.fragment_business_order_evaluated_tv:
                initColor();
                fragment_business_order_evaluated_tv.setTextColor(getActivity().getResources().getColor(R.color.pale_red_color));
                break;

            case R.id.fragment_business_order_refunds_tv:
                initColor();
                fragment_business_order_refunds_tv.setTextColor(getActivity().getResources().getColor(R.color.pale_red_color));
                break;

        }

    }

    private void initColor() {
        fragment_business_order_bepay_tv.setTextColor(getActivity().getResources().getColor(R.color.text_color));
        fragment_business_order_beused_tv.setTextColor(getActivity().getResources().getColor(R.color.text_color));
        fragment_business_order_evaluated_tv.setTextColor(getActivity().getResources().getColor(R.color.text_color));
        fragment_business_order_refunds_tv.setTextColor(getActivity().getResources().getColor(R.color.text_color));
    }
}
